﻿using System.Timers;
using System.Xml.Serialization;
using log4net;
using System.Reflection;

namespace DC2010.Objects.Base
{
    public class BaseObject
    {
        private readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        private string _id = "";
        /// <summary>
        /// Id of object
        /// </summary>
        [XmlAttribute]
        public string Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
                if (!string.IsNullOrEmpty(value))
                    log.Debug("Core, Created object with ID: " + value);

            }
        }

        /// <summary>
        /// Object short name
        /// </summary>
        [XmlAttribute]
        public string ShortName { get; set; }

        /// <summary>
        /// Object full name
        /// </summary>
        [XmlAttribute]
        public string LongName { get; set; }

        /// <summary>
        /// How many divine point can I extract from this object
        /// </summary>
        [XmlAttribute]
        public int DivinePoints { get; set; }

        /// <summary>
        /// Base object type. Doplnit lepsi komentar
        /// </summary>
        [XmlAttribute]
        public BaseObjectType Type { get; set; }
        
        [XmlIgnore]
        public Timer Timer { get; set; }

        public BaseObject()
        {
        }

        public virtual bool Validate() { return false; }

        public override string ToString()
        {
            return Id;
        }
    }
}
